
import {Session} from '/@/utils/storage';
export const tableOption = {
  labelPosition: 'right',
  
  border: true,
  index: true,
  indexLabel: '序号',
  emptyBtn: true,
  emptyText: '清空',
  indexWidth: 60,
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  searchMenuSpan: 6,
  dialogWidth:'50%',
  searchMenuPosition: 'left',
  searchLabelWidth: 'auto',
  selection: true,
  addBtn: false,
  editBtn: false,
  viewBtn: true,
  menuWidth: 280,
  column: [
    {
      type: 'input',
      label: '告警类型',
      search: true,
      overHidden: true,
      width: 180,
      prop: 'alarmTypeName'
    },
    {
      type: 'select',
      label: '告警等级',
      prop: 'alarmLevel',
      search: true,
      overHidden: true,
      dicUrl:'/api/admin/dict/type/alarm_level',
      dicHeaders: {
        authorization: 'Bearer ' + Session.get('token')
      },
      props:{
          label: 'label',
          value: 'value'
      }
    },
    {
      type: 'input',
      label: '设备名称',
      width: 200,
      overHidden: true,
      prop: 'unitName',
    },
    {
      type: 'input',
      label: '告警内容',
      overHidden: true,
      width: 200,
      prop: 'alarmContent',
    },
    {
      type: 'select',
      label: '告警状态',
      searchOrder: 1,
      search: true,
      prop: 'alarmStatus',
      dicData: [
        {
          label: '未确认',
          value: '0'
        },
        {
          label: '已确认',
          value: '1'
        }
      ]
    },
    {
      type: 'select',
      label: '是否已读',
      search: true,
      prop: 'isRead',
      dicData: [
        {
          label: '未读',
          value: '0'
        },
        {
          label: '已读',
          value: '1'
        }
      ]
    },
    {
      type: 'input',
      label: '告警值',
      prop: 'alarmValue',
      formatter: (val:any) => {
        if(val.alarmValue) {
          return val.alarmValue + ' ' +  val.unit;
        } else {
          return '-'
        }
        
      }
    },
    {
      type: 'input',
      label: '单位',
      hide: true,
      prop: 'unit',
    },
    
    {
      type: 'input',
      label: '阈值',
      prop: 'fixedValue',
    },
    {
      type: 'input',
      label: '工单编号',
      prop: 'orderCode',
    },
    {
      type: 'input',
      label: '工单状态',
      prop: 'orderStatus',
      dicData: [
        {
          label: '未处理',
          value: '0'
        },
        {
          label: '已处理',
          value: '1'
        }
      ]
    },
    {
      type: 'input',
      label: '告警时间',
      search: true,
      width: 180,
      prop: 'happenTime',
    },
    {
      type: 'input',
      label: '推送用户',
      width: 180,
      prop: 'senderName',
      overHidden: true
    },
    {
      type: 'input',
      label: '创建时间',
      hide: true,
      addDisplay: false,
      editDisplay: false,
      prop: 'createTime'
    }
  ]
}
